<template>
  <PageBox :data="dataInfo" @searchBtn="getTbody" :maring="maring" :isRadio="isRadio" :isCheckbox="isCheckbox"
    @tableCheckboxBtn="tableCheckboxBtn" @tableRadioBtn="tableRadioBtn">
    <template #search="{ search }">
      <ElFormItemBox label="单据状态" prop="getMaterialBillState">
        <ElSelectBox :data="search" dataName="getMaterialBillState" :all="{
          label: '全部',
          value: -1,
        }" :options="options.state" />
      </ElFormItemBox>
      <ElFormItemBox label="领料类型" prop="getMaterialType">
        <ElSelectBox :data="search" dataName="getMaterialType" :all="{
          label: '全部',
          value: 0,
        }" :options="options.getMaterialType" />
      </ElFormItemBox>
      <ElFormItemBox label="出库状态" prop="outStockState">
        <ElSelectBox :data="search" dataName="outStockState" :all="{
          label: '全部',
          value: -1,
        }" :options="options.outStockState" />
      </ElFormItemBox>
    </template>
    <template #headR>
    </template>
    <template #getMaterialBillStateName="{ row }">
      <ElTagBox :data="row.getMaterialBillState" :options="options.state" />
    </template>
    <template #outStockStateName="{ row }">
      <ElTagBox :data="row.outStockState" :options="options.outStockState" />
    </template>

    <template #getMaterialBillNo="{ row }">
      <PopoverTabel :title="row.getMaterialBillNo" :width="1000" :thead="[
        {
          label: '规格编号',
          prop: 'specificationCode',
          align: 'center',
          width: 100,
        },
        {
          label: '物料名称',
          prop: 'goodsName',
          align: 'left',
          width: 220,
        },
        {
          label: '规格型号',
          prop: 'specificationName',
          align: 'left',
          width: 100,
        },
        {
          label: '供应商',
          prop: 'supplierName',
          align: 'left',
          width: 200,
        },
        {
          label: '领料数量',
          prop: 'applyGetQuantity',
          align: 'center',
          width: 100,
        },
        {
          label: '备注',
          prop: 'backRemark',
          align: 'center',
          width: null,
        },
      ]" :tbody="row.getProduceMaterialMxList" />
    </template>
  </PageBox>
</template>
<script setup lang="ts">
const { proxy } = getCurrentInstance() as any;
import './pageCss.scss'; // 引入样式
import { useListComponent } from './pageTs'; // 引入逻辑
const props = withDefaults(
  defineProps<{
    isRadio?: boolean; //单选
    isCheckbox?: boolean; //多选
    maring?: number; //多选
  }>(),
  {
  },
);
const emit = defineEmits<{
  //fn为父组件引入子组件是定义的子组件事件属性，可随意定义
  (event: 'tableRadioBtn', row: any): void;
  (event: 'tableCheckboxBtn', arr: any): void;
}>();
//多选数据
const tableCheckboxBtn = (arr: any) => {
  emit('tableCheckboxBtn', arr);
};
//单选数据
const tableRadioBtn = (row: any) => {
  emit('tableRadioBtn', row);
};
// 组件挂载后执行
onMounted(() => {
  getTbody();
});
const { dataInfo, getTbody, options } = useListComponent();
</script>
